package ZiXi;

import java.util.Scanner;

public class Bu0403 {
    public static void main(String[] args) {

        String ss = " ";
        Scanner sc = new Scanner(System.in);
        String next = sc.next();
        while (!next.endsWith("end")) {
            System.out.println("录入字符串");
            next = next + sc.nextLine();
        }
        System.out.println("你输入的字符串为:" + next);
        getUpperLower(next);
    }

    public static void getUpperLower(String string) {
        char[] ch = string.toCharArray();
        int count = 0;
        for (int i = 0; i < ch.length; i++) {
            if (ch[i] > 'A' && ch[i] < 'Z') {
                ch[i] = (char) (ch[i] + 32);
                count++;
            } else if (ch[i] > 'a' && ch[i] < 'z') {
                ch[i] = (char) (ch[i] - 32);
                count++;
            } else {
                ch[i] = '*';
            }
        }
        String string2 = "";
        for (int k = 0; k < ch.length; k++) {
            string2 += ch[k];
        }
        System.out.println("结果是：" + string2 + "，总共有" + count + "个字母");
    }
}


    /* while ( ss.equals("end")==false){
            System.out.println("录入字符串");
            Scanner st=new Scanner(System.in);，
             ss=st.next();
        }*/
       /* char[] chars=ss.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            char c=chars[i];
            if(c>='a'&&c<='z'){
               chars[i]='a'-32;
            }else if(c>='A'&&c<='Z'){
                chars[i]='a'+32;
            }else {
                chars[i]='*';
            }
        }
        for (int i = 0; i < chars.length; i++) {
            System.out.print(chars[i]);
        }
    }
}
*/